home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / pleas / win / wiper / wiper.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-06  |  6.3 KB  |  192 lines

  1. VERSION 2.00
  2. Begin Form Wiper 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "wiper"
  5.    ClientHeight    =   900
  6.    ClientLeft      =   7845
  7.    ClientTop       =   435
  8.    ClientWidth     =   810
  9.    ClipControls    =   0   'False
  10.    ControlBox      =   0   'False
  11.    FontBold        =   -1  'True
  12.    FontItalic      =   0   'False
  13.    FontName        =   "System"
  14.    FontSize        =   9.75
  15.    FontStrikethru  =   0   'False
  16.    FontUnderline   =   0   'False
  17.    Height          =   1305
  18.    Icon            =   0
  19.    Left            =   7785
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    Picture         =   WIPER.FRX:0000
  25.    ScaleHeight     =   900
  26.    ScaleWidth      =   810
  27.    Top             =   90
  28.    Width           =   930
  29.    Begin Label lblExit 
  30.       Alignment       =   2  'Center
  31.       Caption         =   "Exit"
  32.       ForeColor       =   &H00000080&
  33.       Height          =   210
  34.       Left            =   0
  35.       TabIndex        =   0
  36.       Top             =   480
  37.       Width           =   495
  38.    End
  39.    Begin Menu mnu_Settings 
  40.       Caption         =   "Settings"
  41.       Visible         =   0   'False
  42.       Begin Menu mnu_Code 
  43.          Caption         =   "&Code Windows"
  44.          Checked         =   -1  'True
  45.       End
  46.       Begin Menu mnu_Form 
  47.          Caption         =   "&Form Windows"
  48.          Checked         =   -1  'True
  49.       End
  50.       Begin Menu mnu_MDI 
  51.          Caption         =   "&MDI Window"
  52.          Checked         =   -1  'True
  53.       End
  54.       Begin Menu mnu_sep1 
  55.          Caption         =   "-"
  56.       End
  57.       Begin Menu mnu_Debug 
  58.          Caption         =   "&Debug"
  59.       End
  60.       Begin Menu mnu_Project 
  61.          Caption         =   "P&roject"
  62.       End
  63.       Begin Menu mnu_Properties 
  64.          Caption         =   "Pr&operties"
  65.       End
  66.       Begin Menu mnu_Toolbox 
  67.          Caption         =   "&Toolbox"
  68.       End
  69.    End
  70. DefInt A-Z
  71. Const GW_HWNDNEXT = 2
  72. Const GW_OWNER = 4
  73. Const WM_SYSCOMMAND = &H112
  74. Declare Function FindWindow Lib "User" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
  75. Declare Function GetClassName Lib "User" (ByVal hWnd As Integer, ByVal lpClassName As String, ByVal nMaxCount As Integer) As Integer
  76. Declare Function GetNextWindow Lib "User" (ByVal hWnd As Integer, ByVal wFlag As Integer) As Integer
  77. Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
  78. Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
  79. Dim sBuff As String * 64
  80. Dim iHWnds() As Integer
  81. Dim TPRatio%
  82. Sub Form_Click ()
  83.     WipeDialog "#32770", "View Procedures"
  84.     If mnu_Code.Checked Then WipeWindows "OEBDebug"
  85.     If mnu_Toolbox.Checked Then WipePopup "ToolsPalette"
  86.     If mnu_Project.Checked Then WipePopup "PROJECT"
  87.     If mnu_Debug.Checked Then WipePopup "OFEDT"
  88.     If mnu_Properties.Checked Then WipePopup "wndclass_pbrs"
  89.     If mnu_Form.Checked Then WipeForms "ThunderForm"
  90.     If mnu_MDI.Checked Then WipeForms "ThunderMDIForm"
  91. End Sub
  92. Sub Form_Load ()
  93.     TPRatio% = Screen.TwipsPerPixelX
  94.     Me.Width = 39 * TPRatio%
  95.     Me.Height = (32 * TPRatio%) + (14 * TPRatio%) + (20 * TPRatio%)
  96.     lblExit.Width = 39 * TPRatio%
  97. End Sub
  98. Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  99.     If Button = 2 Then
  100.         PopupMenu mnu_Settings
  101.     End If
  102. End Sub
  103. Sub lblExit_Click ()
  104.     Unload Me
  105.     End
  106. End Sub
  107. Sub mnu_Code_Click ()
  108.     mnu_Code.Checked = Not mnu_Code.Checked
  109. End Sub
  110. Sub mnu_Debug_Click ()
  111.     mnu_Debug.Checked = Not mnu_Debug.Checked
  112. End Sub
  113. Sub mnu_Form_Click ()
  114.     mnu_Form.Checked = Not mnu_Form.Checked
  115. End Sub
  116. Sub mnu_MDI_Click ()
  117.     mnu_MDI.Checked = Not mnu_MDI.Checked
  118. End Sub
  119. Sub mnu_Project_Click ()
  120.     mnu_Project.Checked = Not mnu_Project.Checked
  121. End Sub
  122. Sub mnu_Properties_Click ()
  123.     mnu_Properties.Checked = Not mnu_Properties.Checked
  124. End Sub
  125. Sub mnu_Toolbox_Click ()
  126.     mnu_Toolbox.Checked = Not mnu_Toolbox.Checked
  127. End Sub
  128. Sub WipeDialog (class$, title$)
  129.     hWindow% = FindWindow(class$, title$)
  130.     If hWindow% = 0 Then Exit Sub
  131.     i% = SendMessage(hWindow%, WM_SYSCOMMAND, &HF060, 0&)
  132.     DoEvents
  133. End Sub
  134. Sub WipeForms (class$)
  135.     ReDim iHWnds(100)
  136.     cnt% = 0
  137.     ' Find first ThunderForm, check Owner (not Parent)
  138.     ' May be either design environment or running app
  139.     hWindow% = FindWindow(class$, 0&)
  140.     If hWindow% = 0 Then Exit Sub
  141.     hParent% = GetWindow(hWindow%, GW_OWNER)
  142.     iZot = GetClassName(hParent%, sBuff, Len(sBuff))
  143.     sClass$ = Trim$(Left$(sBuff, iZot))
  144.     If InStr(sClass$, "ThunderMain") Then
  145.         iHWnds(cnt%) = hWindow%
  146.         cnt% = cnt% + 1
  147.     End If
  148.     ' Look through the window chain, saving hWnds.
  149.     ' Closing windows now hoses GetNextWindow().
  150.     For z = 1 To 1000
  151.         hWindow% = GetNextWindow(hWindow%, GW_HWNDNEXT)
  152.         If hWindow% = 0 Then Exit For
  153.         iZot = GetClassName(hWindow%, sBuff, Len(sBuff))
  154.         sClass$ = Trim$(Left$(sBuff, iZot))
  155.         If sClass$ = class$ Then
  156.             hParent% = GetWindow(hWindow%, GW_OWNER)
  157.             iZot = GetClassName(hParent%, sBuff, Len(sBuff))
  158.             sClass$ = Trim$(Left$(sBuff, iZot))
  159.             If InStr(sClass$, "ThunderMain") Then
  160.                 iHWnds(cnt%) = hWindow%
  161.                 cnt% = cnt% + 1
  162.             End If
  163.         End If
  164.     Next z
  165.     ' Blow away the windows.
  166.     For z = 0 To cnt% - 1
  167.         i% = SendMessage(iHWnds(z), WM_SYSCOMMAND, &HF060, 0&)
  168.     Next z
  169.     DoEvents
  170. End Sub
  171. Sub WipePopup (class$)
  172.     hWindow% = FindWindow(class$, 0&)
  173.     hParent% = GetWindow(hWindow%, GW_OWNER)
  174.     iZot = GetClassName(hParent%, sBuff, Len(sBuff))
  175.     sClass$ = Trim$(Left$(sBuff, iZot))
  176.     If InStr(sClass$, "ThunderMain") Then
  177.         i% = SendMessage(hWindow%, WM_SYSCOMMAND, &HF060, 0&)
  178.     End If
  179. End Sub
  180. Sub WipeWindows (title$)
  181.     ' Repeatedly search window chain; close each one
  182.     Do
  183.         hWindow% = FindWindow(title$, 0&)
  184.         If hWindow% <> 0 Then
  185.             i% = SendMessage(hWindow%, WM_SYSCOMMAND, &HF060, 0&)
  186.             DoEvents
  187.         Else
  188.             Exit Do
  189.         End If
  190.     Loop
  191. End Sub
  192.